<?php
  $total_records = 67 ;
  $cols = 5;
  $rows = ceil($total_records / $cols);
  $count = 1;

?>
<table  border="1" width="80%" align="center">
<?php
  for ($i = 1; $i <= $rows; $i++) {
    $color = ($i%2==0)?'yellow':'pink';
    $num = $i;
?>
    <tr style="background:<?=$color?>">
      <?php for($j=1 ; $j<= $cols ; $j++) {

if($count <= $total_records && ($num) <= (($cols*$rows)) && $num <= $total_records) {
  $count++;
      ?>
      <td align="center">ITEM-<?=$num?></td>
      <?php
      $num += $rows;
} else {//end if()
?>
      <td align="center">&nbsp;</td>
<?php
}
      }//end for()?>

    </tr>
<?php
  }
?>
</table>
